#ifndef __CPES_H__
#define __CPES_H__

#include "CDynamicArray.h"

/** 
This class holds the PES data. 
*/
class CPES
{
public:
	/**
	c'tor.
	@param cDynamicArray- pointer to the CDynamicArray class from where the data should be copied
	*/
	CPES(CDynamicArray* cDynamicArray);
	~CPES(void);
	/**
	@return pointer to the payload data of the PES
	*/
	const char* getPayload();
	/**
	@return the length of the header of the PES
	*/
	unsigned int getPayloadLength();
	/**
	@param cPes- CPES class parameter.
	@return 1 if PTS value of the class is smaller than the PTS value of the parameter ,0 otherwise
	*/
	bool isSmallerThan(const CPES* cPes);


private:
	/** finds the PES's header size and retrieves important fields from the PES's header (m_PTS1,m_PTS2,m_PTS3)*/
	void _parsePesHeader();

	CDynamicArray m_data;
	int m_nHeaderSize;

protected:
	unsigned int m_PTS1, m_PTS2, m_PTS3;
};
/** returns 1 if p1 should be before p2,0 otherwise */
bool PesSortFunction(CPES* p1, CPES* p2);

#endif 

